<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
	return redirect('/get_code');
});

Route::get('/get_code/{uri?}','WeChatsController@getcode')->middleware('web');
Route::get('/get_token_openid/{uri?}','WeChatsController@getopenid')->middleware('web');
Route::group(['prefix'=>'/crontab/','namespace'=>'Crontab'],function(){
   Route::get('update_activity_status','CtontabController@modiActivityStatus');
});

//---------------前台路由开始--------------------------

// 会员注册路由
Route::group(['prefix'=>'/service/','middleware' => ['web']],function(){
    Route::get('get_token','RegisterController@getToken');
	Route::get('getcode/{telephone}','RegisterController@getcode');
	//Route::post('register','RegisterController@register');
	//Route::post('login','RegisterController@login');
    //Route::get('login/{telephone}','RegisterController@login');
	Route::post('sign_up','SignUpController@store');
	Route::get('islogin/{mid}','SignUpController@islogin');
	Route::get('myactivity/{mid}','SignUpController@list');
	Route::get('personal_center/{mid}','CenterController@personalCenter');
	Route::post('insert_address','CenterController@storeAddress');
	Route::post('update_address','CenterController@updateAddress');
	Route::get('dset_address/{id}/{mid}','CenterController@setDefaultAddress');
	Route::get('del_address','CenterController@delAddress');
	Route::post('update_personal_msg','CenterController@updatePersonalMsg');
	Route::get('address_list/{mid}','CenterController@getAddress');
	Route::post('bind_telephone','CenterController@BindTelephone');
});

// 活动报名路由
Route::group(['prefix'=>'/activity/','middleware' => ['web']],function(){
	Route::get('list/{mid}','ActivityController@list');
	Route::get('view/{id}/{mid}','ActivityController@view');
	//Route::get('citylist','ActivityController@citylist');
	//Route::get('city_activity/{id}','ActivityController@getActivityList');
});

// 宝宝信息添加路由
Route::group(['prefix'=>'/baby/','middleware' => ['web']],function(){
	Route::post('insertbaby','BabyController@insert');
	Route::get('babylist/{mid}','BabyController@list');
	Route::get('modifybaby/{id}','BabyController@getBabyInfo');
	Route::post('editbaby','BabyController@updateBaby');
	Route::get('delbaby/{id}','BabyController@del');
});

// 测评题库路由
Route::group(['prefix'=>'/evaluation/','middleware' => ['web']],function(){
	Route::get('qlist/{mid}/bid/{bid}','EvaluationController@qlist');
	Route::post('qadd','EvaluationController@qadd');
	Route::get('eva_res/{mid}/bid/{bid}','EvaluationController@getEvaluationRes');
	Route::get('evaluationlog/{mid}','EvaluationController@evaluationlog');
});

// 我的消息路由
Route::group(['prefix'=>'/mymessage/','middleware' => ['web']],function(){
    Route::get('mymessage/list/{mid}','MessageController@list');
    Route::get('info/{id}/{company}','MessageController@view');
    Route::post('editmsg','MessageController@updatemsg');
});


// 课程信息路由
Route::group(['prefix'=>'/course/'],function(){
    Route::get('recommendList/{memberid}','CourseController@RecommendList');
	Route::get('courseinfo/{id}/{mid?}','CourseController@courseinfo');
	Route::get('contentinfo/{id}/{mid?}','CourseController@courseContentInfo');
	Route::post('add_comment','CourseController@addComment');
	Route::post('add_collection','CourseController@addCollection');
	Route::get('recommend_course_list','CourseController@recommendCourseList');
	Route::get('courselist/{type_id}','CourseController@courselist');
	Route::get('course_more_list/{type_id}','CourseController@courseMoreList');
});

// 收藏路由
Route::group(['prefix'=>'/collection/','middleware' => ['web']],function(){
	Route::get('collection_list/{mid}','CollectionController@list');
	Route::get('del_collection/{id}','CollectionController@del');
});

// 订单路由
Route::group(['prefix'=>'/order/','middleware' => ['web']],function(){
	Route::get('orderlist/{mid}','OrderController@list');
    Route::post('addorder','OrderController@AddOrder');
    Route::post('edit_order_product_num','OrderController@updateProductNum');
    Route::get('orderInfo/{id}/{mid}','OrderController@view');
    Route::post('modify_order_address','OrderController@updateAddress');
    Route::get('modi_order_status/{id}/{mid}','OrderController@ModiOrderStatus');
});

// 锻炼记录路由
Route::group(['prefix'=>'/motion/','middleware' => ['web']],function(){
	Route::get('motionlist/{mid}','MotionController@list');
	Route::post('addmotion','MotionController@store');
});

// 会员反馈
Route::group(['prefix'=>'/feedback/','middleware' => ['web']],function(){
    Route::post('add_question','FeedBackController@store');
    Route::post('upload','FeedBackController@upload');
});

// 教具路由
/*Route::group(['prefix'=>'/aids/'],function(){
    Route::get('teachingaids','TeachingAidsController@view');
    Route::post('add_collection','TeachingAidsController@addCollection');
    Route::get('aidlist/{id}','TeachingAidsController@aidList');
    Route::get('aidinfo/{id}','TeachingAidsController@aidInfo');
});*/

// 省市区，三级联动路由
Route::group(['prefix'=>'/linkage/'],function(){
    Route::get('province_list','LinkageController@province');
    Route::get('city_list/{id}','LinkageController@city');
    Route::get('county_list/{id}','LinkageController@county');
});

// 微信支付路由
Route::group(['prefix'=>'/wechat/','middleware' => ['web']],function(){
    Route::post('pay', 'WechatController@pay');
    Route::post('notify','WechatController@notify');
    Route::get('getcode','RegisterController@getWechatCode');
    Route::post('share','ShareController@run');
});



//---------------前台路由结束--------------------------

//---------------后台路由开始--------------------------

Route::get('/admin',function(){
	return redirect('/admin/login');
});

// 后台-登录模块
Route::group(['prefix'=>'admin/login','namespace'=>'Admin'],function(){
	Route::get('','LoginController@login');
	Route::post('/checkuser','LoginController@check');
	Route::get('/logout','LoginController@logOut');
	Route::get('/adduser','LoginController@add_user');
});

// 后台-首页模块
Route::get('admin/home','Admin\HomeController@index');

// 公共接口部分
Route::group(['prefix'=>'admin/common/','namespace'=>'Admin'],function(){
	Route::post('upload','CommonController@upload');
	Route::get('getcitylist/{id}','CommonController@getcitylist');
	Route::get('getcountylist/{id}','CommonController@getcountylist');
	Route::get('getprovincelist','CommonController@getprovincelist');
	Route::get('getcoursetypelist/{pid}','CommonController@getColumnList');
	Route::get('gettoken','CommonController@gettoken');
	Route::get('getsign/{directory}','OssUploadController@getSign');
	Route::post('oss_callback','OssUploadController@callback');
});

// 后台-资料管理模块
Route::group(['prefix'=>'admin/material','namespace'=>'Admin'],function(){
	Route::post('/uploads','MaterialController@uploads');
	Route::get('/list/{page?}/{pagesize?}','MaterialController@list');
	Route::get('/add','MaterialController@create');
	Route::post('/insert','MaterialController@store');
	Route::get('/edit/{id}','MaterialController@edit');
	Route::post('/update','MaterialController@update');
	Route::get('/del/{id}','MaterialController@del');
	Route::get('/undercarriage/{id}','MaterialController@undercarriage');
	Route::get('/grounding/{id}','MaterialController@grounding');
});
// Route::resource('admin/material','\Admin\MaterialController');

// 后台-用户管理
Route::group(['prefix'=>'admin/user','namespace'=>'Admin'],function(){
	Route::get('/list/{page?}/{pagesize?}','UserController@list');
	Route::get('/add','UserController@create');
	Route::post('/insert','UserController@store');
	Route::get('/edit/{id}','UserController@edit');
	Route::post('/update','UserController@update');
	Route::get('/del/{id}','UserController@del');
});

// 后台-会员管理
Route::group(['prefix'=>'admin/member','namespace'=>'Admin'],function(){
	Route::get('/list','MemberController@list');
});

// 后台-课程分类管理
Route::group(['prefix'=>'admin/coursetype','namespace'=>'Admin'],function(){
	Route::get('/list/{page?}/{pagesize?}','CourseTypeController@list');
	Route::get('/add','CourseTypeController@create');
	Route::post('/insert','CourseTypeController@store');
	Route::get('/edit/{id}','CourseTypeController@edit');
	Route::post('/update','CourseTypeController@update');
	Route::get('/del/{id}','CourseTypeController@del');
});

// 后台-课程标签管理
Route::group(['prefix'=>'admin/tag','namespace'=>'Admin'],function(){
	Route::get('/list','TagController@list');
	Route::get('/add','TagController@create');
	Route::post('/insert','TagController@store');
	Route::get('/edit/{id}','TagController@edit');
	Route::post('/modify','TagController@update');
	Route::get('/del/{id}','TagController@del');
});

// 后台-课程管理
Route::group(['prefix'=>'admin/course','namespace'=>'Admin'],function(){
	Route::get('/list','CourseController@list');
	Route::get('/add','CourseController@create');
	Route::post('/insert','CourseController@store');
	Route::get('/edit/{id}','CourseController@edit');
	Route::post('/update','CourseController@update');
	Route::get('/del/{id}','CourseController@del');
	Route::post('/upload','CourseController@upload');
	Route::get('/view_video_list/{id}','CourseController@viewVideoList');
	Route::get('/video_edit/{id}/num/{num}','CourseController@videoEdit');
	Route::post('/video_modi','CourseController@videoUpdate');
	Route::get('/video_del/{id}','CourseController@videoDel');
	Route::post('/set_order_by','CourseController@SetOrderBy');
	Route::get('/give_course/{id}','CourseController@giveCourse');
    Route::post('/give_course_handle','CourseController@HandleGiveCourse');
    Route::get('/give_course_list/{courseid}','CourseController@GiveCourseList');
});

// 后台-教具管理
Route::group(['prefix'=>'admin/teaching','namespace'=>'Admin'],function(){
	Route::post('upload_teach_aid','TeachingAidsController@uploadTeachAid');
	Route::get('/talist','TeachingAidsController@talist');
	Route::get('/taadd','TeachingAidsController@createTa');
	Route::post('/tainsert','TeachingAidsController@insertTa');
	Route::get('/taedit/{id}','TeachingAidsController@editTa');
	Route::post('/taupdate','TeachingAidsController@updateTa');
	Route::get('/tadel/{id}','TeachingAidsController@delTa');
	Route::get('/taview/{id}','TeachingAidsController@viewTa');
	Route::get('/aidadd/{id}','TeachingAidsController@create');
	Route::post('/aidinsert','TeachingAidsController@insert');
	Route::get('/aidedit/{id}','TeachingAidsController@edit');
	Route::post('/aidupdate','TeachingAidsController@update');
	Route::get('/aiddel/{id}','TeachingAidsController@del');
});

// 后台-订单管理
Route::group(['prefix'=>'admin/order','namespace'=>'Admin'],function(){
	Route::get('/list','OrderController@list');
	Route::get('/vieworder/{id}','OrderController@view');
	Route::get('/closeorder/{id}','OrderController@close');
	Route::get('/cancelorder/{id}','OrderController@cancel');
	Route::post('/modifylogisticsmsg','OrderController@modifyLogistics');
});

// 后台-反馈管理
Route::get('admin/feedback/list','Admin\FeedBackController@list');
Route::get('admin/feedback/del/{id}','Admin\FeedBackController@del');

// 后台-测试题库
Route::group(['prefix'=>'admin/item_bank/','namespace'=>'Admin'],function(){
	Route::get('list','ItemBankController@qlist');
	Route::get('add','ItemBankController@qcreate');
	Route::post('insert','ItemBankController@qstore');
	Route::get('modify/{id}','ItemBankController@qedit');
	Route::post('save','ItemBankController@qupdate');
	Route::get('del/{id}','ItemBankController@qdel');
	Route::get('alist/{id}','ItemBankController@a_list');
	Route::get('anadd/{id}','ItemBankController@a_create');
	Route::post('ainsert','ItemBankController@a_insert');
	Route::get('a_modify/{id}','ItemBankController@a_edit');
	Route::post('a_save','ItemBankController@a_update');
	Route::get('a_del/{id}','ItemBankController@a_del');
});

// 后台测试报告
Route::group(['prefix'=>'admin/test_report/','namespace'=>'Admin'],function(){
    Route::get('list','TestReportController@list');
    Route::get('add','TestReportController@create');
    Route::post('insert','TestReportController@store');
    Route::get('edit/{id}','TestReportController@edit');
    Route::post('save','TestReportController@update');
    Route::get('del/{id}','TestReportController@del');
});

// 活动报名管理
Route::group(['prefix'=>'admin/activity/','namespace'=>'Admin'],function(){
	Route::get('list','ActivityController@list');
	Route::get('add','ActivityController@create');
	Route::post('insert','ActivityController@store');
	Route::get('modify/{id}','ActivityController@edit');
	Route::post('update','ActivityController@update');
	Route::get('del/{id}','ActivityController@del');
	Route::get('sign_user_list/{activityid}','ActivityController@SignUserList');
});

//---------------后台路由结束--------------------------
